package com.maybach.workflow.core.repository;

import com.maybach.workflow.common.model.*;

import java.util.List;

/**
 * Created by houenxun on 16/1/20.
 */
public interface IFlowRepository {
    /**
     * 根据主键查询流程
     * @param flowId
     * @return
     */
    FlowDO getFlowById(Long flowId);

    List<FlowTaskDO> getFlowTasksByFlowId(Long flowId);

    /**
     * 更新流程状态
     * @param flowId
     * @param status
     * @return
     */
    boolean updateFlowStatus(Long flowId, int status);


    FlowTaskHisDO getFlowTaskHistByTaskId(Long taskId);

    FlowTaskDO getFlowTaskById(Long taskId);

    List<FlowDO> getFlowByBizIdAndType(Long bizId,String flowBizType);

    Long createFlowActLog(FlowActLogDO flowActLogDO);

    Long createFlowTask(FlowTaskDO taskDO);

    void createTaskActors(List<FlowTaskActorDO> list);

    Long createFlowTaskHis(FlowTaskHisDO hisDO);


    boolean delFlowTaskById(Long taskId);


    List<FlowTaskHisDO> getFlowTaskHissByFlowId(Long flowId);

    boolean updateTaskHistState(Long taskHisId, Integer status);

    FlowTaskDO getTaskByType(Long id, String name, String name1);

    List<FlowTaskDO> getFlowTasksByFlowIdAndType(Long id, String name);

    /**
     * 根据任务id清理执行者
     * @param taskId
     * @return
     */
    boolean clearTaskActorByTaskId(Long taskId);

    Long createFlow(FlowDO flowDO);

    FlowTaskDO getFlowTaskWithName(Long id, String actionName);

    /**
     * 根据任务id获取任务的所有操作者
     * @param taskId
     * @return
     */
    List<FlowTaskActorDO> getTaskActorsByTaskId(Long taskId);
}
